import request from "@/utils/request";

const baseURL = "/system/tenant";

/**
 * 根据域名获取租户id
 * @param domain 域名
 * @returns 租户id
 */
export const getTenantIdByDomain = (domain: string) =>
  request<Res<TenantInfo["id"]>>({
    url: `${baseURL}/get-tenant-id-by-domain`,
    method: "GET",
    params: { domain },
    noLogin: true,
  });

/**
 * 获取当前登录用户所在租户的信息
 * @returns 当前的租户信息
 */
export const getTenantInfo = () =>
  request<Res<TenantInfo>>({
    url: `${baseURL}/get-tenant-info`,
    method: "GET",
    noLogin: true,
  });
